#include "UNetOnnx.h"
#include "time.h"
// vs: -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="/O2" -DCMAKE_C_FLAGS="/O2"
// gcc: -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS="-O3" -DCMAKE_C_FLAGS="-O3"
// 注意拷贝onnxruntime动态库到bin目录，否则和windows自带的一个冲突
int main(){
    double start, end;
    std::string model_path = "../../../3-NNUnetWithOnnxAndOpenVino/v1_onnx.onnx";
    std::string sampleImage = "../../../resource/raw_resize/1.jpg";

    start = (double ) clock();
    UNetOnnx onnx_model(model_path);
    end = (double ) clock();
    std::cout << "init time: " << (end - start) / CLOCKS_PER_SEC << " s" << std::endl;

    start = (double ) clock();
    cv::Mat result = onnx_model.infer(sampleImage);
    cv::imwrite("out.png", result);
    end = (double ) clock();
    std::cout << "infer time: " << (end - start) / CLOCKS_PER_SEC << " s" << std::endl;

    start = (double ) clock();
    cv::Mat result1 = onnx_model.infer(sampleImage);
    end = (double ) clock();
    std::cout << "infer in second: " << (end - start) / CLOCKS_PER_SEC << " s" << std::endl;

}